/*	talmud - The TALMUD roguelike
 * Copyright (C) 2012, talmud contributors
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of Version 2 of the GNU General Public License as published
 *  by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE. See Version 2 of the GNU General Public
 *  License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef dlvl_h
#define dlvl_h

#include <stdint.h>

#define DLVL_W		80
#define DLVL_H		20
#define DLVL_BASEY	1

#define T_ROCK		0
#define T_FLOOR		1
#define T_POOL		2	// pool of water
#define T_IDOL		3
#define T_UPSTAIR	4
#define T_DNSTAIR	5
#define T_HARDROCK	6
#define T_DTRAP		7	// dart trap
#define T_CORRIDOR	8
#define T_COUNT		9

#define B_DUNGEONS	0
#define B_CATACOMBS	1

#define V_NOTSEEN	0
#define V_WASSEEN	1
#define V_CANSEE	2
#define V_DETAILED	3

typedef struct lvlmeta_s
{
	uint8_t x;
	uint8_t y;
} lvlmeta_t;

typedef struct dlvl_s
{
	uint8_t exists;
	uint8_t branch;
	uint8_t tiles[DLVL_W * DLVL_H];
	uint8_t exposed[DLVL_W * DLVL_H];
	uint8_t fov[DLVL_W * DLVL_H];
	lvlmeta_t upstair;
	lvlmeta_t dnstair;
} dlvl_t;

void GenerateDungeon(dlvl_t *dlvl, uint8_t level);
void GenerateCatacomb(dlvl_t *dlvl, uint8_t level);
uint8_t FindMonSpot(uint8_t *x, uint8_t *y);
uint8_t FindMonSpotNear(uint8_t x, uint8_t y, int8_t *dx, int8_t *dy);
void ExposeLevel(void);
void DrawLevel(void);
uint8_t BlocksSight(uint8_t tile);
uint8_t LOS_BLA(uint8_t ix, uint8_t iy, uint8_t tx, uint8_t ty);

#endif
